#!/usr/bin/bash
#
#  Usage: 每天任务
#  Issue: 2024-05-17
# Author: Leon Hsia
#   Mail: waxwork3@163.com
#  
base_path=$(dirname $(realpath $0))
cd $base_path
# 日志归档
\cp log/access.log log/access.log-`date +%Y%m%d-%s`
\cp log/error.log log/error.log-`date +%Y%m%d-%s`
: >log/access.log
: >log/error.log
find "${base_path}/log" -maxdepth 1 -type f -mtime +7 -name "*[0-9][0-9][0-9][0-9]" -exec zip -rm {}.zip {} \;
find "${base_path}/log" -maxdepth 1 -type f -mtime +180 -exec \rm {} \; 
# 更新GEOIP数据
./x007-download_ngx_http_geoip_db.sh
# 日常重启
./8-reload-config.sh
